{extend name="common/menu_child" /}

{block name="nav"}
<span class="layui-breadcrumb">
	<a>资源回收</a>
	<a><cite>支持物品</cite></a>
</span>
{/block}

{block name="body"}
<div class="layui-row">
	<form class="layui-form layui-col-md12 x-so">
		<input class="layui-input" placeholder="标题" name="title" value="{$condition.title}" />
		<input style="display:none;" name="p" value="1" />
		<button class="layui-btn"><i class="layui-icon">&#xe615;</i></button>
		<a class="layui-btn layui-btn-normal" style="margin-left:0px;" href="{:url('create')}">添加</a>
	</form>
</div>
<table class="layui-table">
	<thead>
		<tr>
			<th>序号</th>
			<th>标题</th>
			<th>图片</th>
			<th>排序</th>
			<th>添加时间</th>
			<th>是否禁用</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{eq name="data_list|count" value="0"}
			<tr>
				<td colspan="20">暂无数据</td>
			</tr>
		{else/}
			{foreach name="data_list" item="vo" key="ko"}
			<tr>
				<td>{$ko + 1}</td>
				<td>{$vo.name}</td>
				<td><a href="{$vo.image}" target="_blank"><img style="height:20px;" src="{$vo.image}" /></a></td>
				<td>{$vo.sort}</td>
				<td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
				<td>{eq name="vo.is_disable" value="0"}正常{else/}已禁用{/eq}</td>
				<td class="td-manage">
					<a title="删除" href="javascript:del({$vo.id});">
						<i class="layui-icon">&#xe640;</i>
					</a>
				</td>
			</tr>
			{/foreach}
		{/eq}
	</tbody>
</table>

<div class="page">{$page}</div>
{/block}

{block name="javascript"}
<script type="text/javascript">
	
	/**
	 * 删除
	 */
	function del(id) {
		layer.confirm('确定要删除吗？', {}, function(){
			let url = '{:url("del")}';
			let data = {id: id};
			action_post_json(url, data, function(response){
				layer.msg(response.message);
				if(0 === response.errno){
					setTimeout(function(){
						window.location.href='{:url("")}';
					}, 1000);
				};
			});
		});
	};
	
</script>
{/block}